package data;

import java.util.Vector;
import data.Degree;

public class StudentData {

	private String firstName , middleInitial , lastName;
	private String citizen, citizenID;
	private String resident, residentID;
	private boolean usCitizen;
	private String variableFieldText, variableField;
	private String street, city, state, countryCode, zip, areaCode, phone;
	private String permanentResident;
	private Vector<Degree> degrees;
	private String specialization, specializationID;
	

	public StudentData()
	{
		firstName=null;
		middleInitial=null;
		lastName=null;
		citizen=null;
		citizenID=null;
		resident=null;
		residentID=null;
		usCitizen=false;
		variableFieldText=null;
		variableField=null;
		street=null;
		city=null;
		state=null;
		countryCode=null;
		zip=null;
		areaCode=null;
		phone=null;
		permanentResident=null;
		degrees = new Vector<Degree>();
		specialization=null;
		specializationID=null;
		
	}
	
	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getMiddleInitial() {
		return middleInitial;
	}

	public void setMiddleInitial(String middleInitial) {
		this.middleInitial = middleInitial;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	
	public String getCitizen() {
		return citizen;
	}

	public void setCitizen(String citizen) {
		this.citizen = citizen;
	}

	public String getCitizenID() {
		return citizenID;
	}

	public void setCitizenID(String citizenID) {
		if(citizen.equals("United States"))
		{
			this.usCitizen = true;
		}
		else
		{
			this.usCitizen = false;
		}
		setAddressVariableField();
		this.citizenID = citizenID;
	}

	public String getResident() {
		return resident;
	}

	public void setResident(String resident) {
		if(resident.equals("United States"))
		{
			this.usCitizen = true;
		}
		else
		{
			this.usCitizen = false;
		}
		setAddressVariableField();
		this.resident = resident;
	}

	public String getResidentID() {
		return residentID;
	}

	public void setResidentID(String residentID) {
		this.residentID = residentID;
	}

	public boolean isUsResident() {
		return usCitizen;
	}

	public void setUsResident(boolean usResident) {
		this.usCitizen = usResident;
	}

	public String getVariableFieldText() {
		return variableFieldText;
	}

	public void setVariableFieldText(String variableFieldText) {
		this.variableFieldText = variableFieldText;
	}

	public String getVariableField() {
		return variableField;
	}

	public void setVariableField(String variableField) {
		this.variableField = variableField;
	}

	public String getStreet() {
		return street;
	}

	public void setStreet(String street) {
		this.street = street;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public String getCountryCode() {
		return countryCode;
	}

	public void setCountryCode(String countryCode) {
		this.countryCode = countryCode;
	}

	public String getZip() {
		return zip;
	}

	public void setZip(String zip) {
		this.zip = zip;
	}

	public String getAreaCode() {
		return areaCode;
	}

	public void setAreaCode(String areaCode) {
		this.areaCode = areaCode;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getPermanentResident() {
		return permanentResident;
	}

	public void setPermanentResident(String permanentResident) {
		this.permanentResident = permanentResident;
	}

	public String getSpecialization() {
		return specialization;
	}

	public void setSpecialization(String specialization) {
		this.specialization = specialization;
	}

	public String getSpecializationID() {
		return specializationID;
	}

	public void setSpecializationID(String specializationID) {
		this.specializationID = specializationID;
	}

	public Vector<Degree> getDegrees() {
		return degrees;
	}

	public void setAddressVariableField()
	{
		if(this.usCitizen == true)
		{
			setVariableFieldText("State:");
			setVariableField("state");
		}
		else
		{
			setVariableFieldText("Country Telephone Code:");
			setVariableField("countryCode");
		}
	}
	
	public void appendToDegreeVector(Degree data)
	{
		this.degrees.add(data);
	}
	
	public Vector<String> getFormData()
	{
		Vector<String> formData = new Vector<String>();
		if(firstName != null && middleInitial != null && lastName != null)
		{
			formData.add(firstName + " " + middleInitial + " " + lastName);
		}
		if(citizen !=null)
		{
			formData.add("Citizen of " + citizen);
		}
		if(resident != null)
		{
			formData.add("Resident of " + resident);
		}
		if(street != null)
		{
			
			formData.add("Address:");
			formData.add("     "+street);
			formData.add("\t"+city);
			if(state != null)
			{
				formData.add("\t"+state);
			}
			else if (countryCode != null)
			{
				formData.add("\t"+countryCode);
			}
			formData.add("\t"+zip);
			formData.add("\t("+areaCode+") "+phone);
		}
		if(permanentResident != null)
		{
			formData.add("Domestic Status: "+permanentResident);
		}
		
		for(int i = 0; i < this.degrees.size(); i++)
		{
			formData.add("");
			formData.add("University: "+degrees.get(i).getUniversity());
			formData.add("Major: " + degrees.get(i).getMajor());
			formData.add("Date Received: " +degrees.get(i).getDate());
			formData.add("GPA: "+degrees.get(i).getGpa());
			formData.add("Degree Type: " +degrees.get(i).getType());
			
		}
		if(specialization != null)
		{
			formData.add("Specialization: " + specialization);
		}
		
		return formData;
	}
	
}
